// 修改后的 deploy.js（兼容 ethers v6）
async function main() {
const [deployer] = await ethers.getSigners();
    console.log("Deploying contracts with the account:", deployer.address);

    const Token = await ethers.getContractFactory("Token");

    // 使用新API部署
    const tokener = await Token.deploy();

    // 等待合约部署确认（ethers v6+）
    await tokener.waitForDeployment();

    // 获取合约地址
    const contractAddress = await tokener.getAddress();
    console.log("token deployed to:", contractAddress);
}
  
main()
.then(() => process.exit(0))
.catch((error) => {
    console.error(error);
    process.exit(1);
});
